package com.lgx.mall.basic.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lgx.common.exception.DataException;
import com.lgx.common.web.Pagination;
import com.lgx.mall.basic.dao.INewsDao;
import com.lgx.mall.basic.entity.News;
import com.lgx.mall.basic.service.INewsService;

@Service("NewsService")
public class NewsService implements INewsService{
	
	@Autowired
	private INewsDao newsDao;

	public INewsDao getNewsDao() {
		return newsDao;
	}

	public void setNewsDao(INewsDao newsDao) {
		this.newsDao = newsDao;
	}

	/**
	 * 创建news
	 */
	@Override
	public News createNews(News news) throws DataException {
		return newsDao.createNews(news);
	}

	/**
	 * 修改news
	 */
	@Override
	public News updateNews(News news) throws DataException {
		return newsDao.updateNews(news);
	}

	/**
	 * 删除news
	 */
	@Override
	public void deleteNews(News news) throws DataException {
		this.newsDao.deleteNews(news);
	}

	/**
	 * 根据id删除news
	 */
	@Override
	public void deleteNewsById(long id) throws DataException {
		this.newsDao.deleteNewsById(id);
	}

	/**
	 * 根据ids删除news
	 */
	@Override
	public void deleteNews(String[] ids) throws DataException {
		this.newsDao.deleteNews(ids);
	}

	@Override
	public News findNewsById(long id) {
		return this.newsDao.findNewsById(id);
	}

	@Override
	public List<News> findNewsList() {
		return this.newsDao.findNewsList();
	}

	/**
	 * 分页查询
	 */
	@Override
	public Pagination findNewsPagination(int type, String starTime,String endTime, String author, int pageSize, int pageNum) {
		return this.newsDao.findNewsPagination(type, starTime, endTime, author, pageSize, pageNum);
	}

	
}
